var mapIds = [867202210];
var 准备地图 = 867202300;

function init() {}

function setup(c, a) {
    em.setProperty("state", 1);
    em.setProperty("leader", "true");
    var c = em.newInstance("莫奈德_地图_Act3.11_最后的野战");
    for (var b = 0; b < mapIds.length; b++) {
        var d = c.setInstanceMap(mapIds[b])
    }
    return c
}

function onItemPickedUp(b, a, c) {}

function onPlayerRegistered(b, a) {
    a.setReviveCount(-100);
    b.startEventTimer(30 * 60 * 1000)
}

function onPlayerRevived(b, a) {
    return false
}

function onMapChanged(c, b, a) {
    if (mapIds.indexOf(a) < 0) {
        on玩家退场(c, b, false);
        return
    }
    em.setProperty("kill", "0");
    em.setProperty("clear", "0");
    em.setProperty("curMap", a)
}

function onPlayerDisconnected(b, a) {
    on玩家退场(b, a, false);
    return 0
}

function onTimeOut(a) {
    a.getPlayers().forEach(function (b) {
        on玩家退场(a, b, true)
    })
}

function onMonsterKilled(b, c) {
    var a = player.getAPI().addNumberForQuestInfo(64135, "kill", 1);
    player.dropMessage(-1, "击杀数量：" + a + "/60");
    if (a == 15) {
        player.getAPI().addPopupSay(9400582, 1500, "艾伊纳尔，不要慌张！", "", 0);
        player.getAPI().addPopupSay(9400582, 1500, "你就记住两点，格挡！戳刺！", "", 0)
    } else {
        if (a == 25) {
            player.getAPI().addPopupSay(9400602, 1500, "喝！唉……没完没了的。等敌人开始进攻……将会有比这更多的怪物……", "", 0);
            player.getAPI().addPopupSay(9400582, 1500, "……你还行吧？加油！", "", 0)
        } else {
            if (a == 60) {
                player.getAPI().fieldEffect_ScreenMsg("monsterPark/clear");
                player.getAPI().fieldEffect_PlayFieldSound("Party1/Clear", 100);
                player.forceCompleteQuest(64135);
                player.scheduleWarpTask(3, 867202314, 0, false)
            }
        }
    }
}

function onPlayerRevived(b, a) {
    return false
}

function onPartyDisbanded(a) {}

function onPlayerKilled(b, a) {}
var setupTask;

function randomNum(b, a) {
    switch (arguments.length) {
        case 1:
            return parseInt(Math.random() * b + 1, 10);
            break;
        case 2:
            return parseInt(Math.random() * (a - b + 1) + b, 10);
            break;
        default:
            return 0;
            break
    }
}

function initProp(a, b) {
    if (em.getProperty(a) == null) {
        em.setProperty(a, b)
    }
}

function initPropArray(a, d, c, e) {
    for (var b = c; b <= e; b++) {
        if (em.getProperty(a + "_" + b) == null) {
            em.setProperty(a + "_" + b, d)
        }
    }
}

function on玩家退场(c, b, a) {
    c.disposeIfPlayerBelow(a ? 999 : 0, 准备地图);
    em.getProperties().clear();
    em.setProperty("state", 0);
    em.setProperty("leader", "true");
    c.unregisterPlayer(b)
};